//
// Prob.hh for math 202 loi in /home/druart_p/Work/math/my-math-epi/202
// 
// Made by pierrick druart
// Login   <druart_p@epitech.net>
// 
// Started on  Tue Feb 28 09:33:27 2012 pierrick druart
// Last update Sun Mar 11 14:08:43 2012 pierrick druart
//

#ifndef __PROB__
#define __PROB__

#include	<map>
#include	<string>
#include	<sstream>
#include	<exception>

#define SIZE_TAB	6

class Prob
{
  private:
    int				val_;
    typedef void		(Prob:: *Function)();
    std::map<int, Function>	func_;

  private:
    Prob();
    Prob(const Prob&);
    Prob&	operator=(const Prob&);

  public:
    Prob(const std::string&);
    ~Prob();
    void	exec();

  private:
    void	option1();
    void	option2();
    void	option3();
    void	option4();
    void	option5();
};

class my_exception_arg : public std::exception
{
  std::string	msg;

public:
  my_exception_arg(const std::string & arg)
  {
    std::ostringstream oss;
    oss << "Wrong argument:\"" << arg << "\".";
    this->msg = oss.str();
  }
  virtual ~my_exception_arg() throw() {}
  virtual const char * what() const throw()
  {
    return this->msg.c_str();
  }
};

class my_exception_help : public std::exception
{
  std::string	msg;

public:
  my_exception_help()
  {
    std::ostringstream oss;
  oss << std::endl << "Usage : ./202loi [n* d'option]." << std::endl << "Option :" \
	<< std::endl << "1- Affiche le tableau de loi de probabilite conjointe de (X, Y) et les loi marginales de X et Y." \
	<< std::endl << "2- Affiche la valeur des quatres nombres deman	des, esperance et variance de X et Y." \
	<< std::endl << "3- Affche le tableau dela loi de propabilite de Z." \
	<< std::endl << "4- Affiche le tableau de la fonction de repartition de Z." \
	<< std::endl << std::endl;
    this->msg = oss.str();
  }
  virtual ~my_exception_help() throw() {}
  virtual const char * what() const throw()
  {
    return this->msg.c_str();
  }
};


#endif /* __PROB__ */
